package org.example.Day5.Collectiontest;
import  java.util.Arrays;
public class Collection1 {
    public static void main(String[] args) {
        //不传递参数，下⾯的nums⻓度则为0, 打印元素是[]
        test();
        //传递3个参数，下⾯的nums⻓度为3，打印元素是[10, 20, 30]
        test(10, 20, 30);

        //传递⼀个数组，下⾯数组⻓度为4，打印元素是[10,20,30,40]
        int[] arr = new int[]{10, 20, 30, 40};
        test(arr);
    }

    public static void test(int... nums) {
        //可变参数在⽅法内部，本质上是⼀个数组
        System.out.println(nums.length);
        System.out.println(Arrays.toString(nums));
        System.out.println("----------------");
    }
}
